﻿#include "PostGraphWidgetLineCallBack.h"

#include <vtkLineWidget2.h>
#include <vtkLineRepresentation.h>

namespace Interface
{
    void PostGraphWidgetLineCallBack::Execute(vtkObject * caller, unsigned long eventId, void * callData)
    {
        Q_UNUSED(eventId);
        Q_UNUSED(callData);

        vtkLineWidget2* widget = vtkLineWidget2::SafeDownCast(caller);
        if (widget == nullptr)return;
        vtkLineRepresentation* lineRep = vtkLineRepresentation::SafeDownCast(widget->GetRepresentation());
        if (lineRep == nullptr)return;
        double* startPoint = lineRep->GetPoint1WorldPosition();
        double* endPoint = lineRep->GetPoint2WorldPosition();
        emit sigValueChange(startPoint, endPoint);
    }
}